home *** CD-ROM | disk | FTP | other *** search
/ CD School House 9 / CD School House 9.0 - Wayzata Technology (1994).iso / pc / dos / math / mafia2a / pcalc.hlp < prev    next >
Text File  |  1992-10-01  |  4KB  |  147 lines

  1.  ╔═════════════════════════════════════════╗   (C) Copyright 1986-1990
  2.  ║  PCALC.EXE - The Programable Calculator ║         Zvi Shippony
  3.  ╚═════════════════════════════════════════╝        (818) 990-0134
  4.  
  5.   This Programable Calculator is very simple to use. At the command line
  6. you can enter few instructions (separated by ; ). To end input, hit ENTER
  7.  
  8.   Example:
  9.  
  10.    x=1;y=sin(x);print 'For X ='x;print 'SIN(X)='y
  11.    run
  12.  
  13.   This will produce the following output:
  14.  
  15.     For X =1.00000000000000E+00   SIN(X)=8.41470984807897E-01
  16.  
  17.   As you can see, a simple language is being used to compute the desired
  18.   results. The language consists of the following commands:
  19.  
  20. $$$
  21.  
  22. 1. Programing commands:
  23.  
  24.     (Any of the following commands could be preceded by a label. A label is
  25.    any 6-char string followed by (:) E.G.,  label1: Var = expression  )
  26.  
  27.    Var = number            ( Var is any string, first letter not a digit and
  28.                              it could be dimensioned,e.g., X(2,3) or A(1,1,1)
  29.                            ** Note: The string: 'PI' is a reserved name !
  30.    Var = expression
  31.    goto label              ( label is any string up to 6 char.)
  32.    if Var1 op Var2 goto label  (where op in [ <  <=  >  >=  =  <> ]
  33.                                 and Var2 can be a number as well.    )
  34.    print var
  35.    print 'ANY STRING' var  ( String must be enclosed with quotes)
  36. $$$
  37.  
  38. 2. Files commands:
  39.  
  40.    Save Filename - To save the program now in core into a file
  41.    Load Filename - To load a program from a file into core
  42.    Edit          - To edit program now in core
  43.    Run           - To run the program now in core
  44.  
  45. $$$
  46.  
  47.   The functions available for programming are:
  48.   --------------------------------------------
  49.  
  50.   ABS, INT, EXP, SIN, COS, TAN, COT, LOG, LN, FACT (Factorial) , SQRT
  51.   SINH, COSH, TANH, ARCSIN, ARCCOS, ARCTAN, ARCSINH, ARCCOSH, ARCTANH
  52.  
  53.  
  54.   Expression is any leagal combination of +,-,*,/,**,(,), Variables names,
  55.   the above functions and Pi ( = 3.1415926536 ).
  56.  
  57.  
  58. $$$
  59.  
  60.    A SIMPLE PROGRAM TO FIND THE SQUARE ROOT OF A NUMBER:
  61.    -----------------------------------------------------
  62.    Suppose we want to compute the sqrt of 34 using an iterative algorithm
  63.    (Newton's). At the command mode, enter the following instructions:
  64.  
  65.     x=1;i=0;a=34;max=20;eps=1.0e-11
  66.     cont:y=(x+a/x)/2.;d=abs(x-y);x=y;i=i+1
  67.     if i>max goto finish;if d>eps goto cont
  68.     finish:print y;print a;print i;print d
  69.     x=sqrt(a);d=abs(x-y);print 'real solution:'x;print 'diff.'d
  70.     run
  71.  
  72.  
  73.    The results will look like:
  74.  
  75. Y:  5.8309518948E+00
  76. A:  3.4000000000E+01
  77. I:  8.0000000000E+00
  78. D:  0.0000000000E+00
  79. REAL SOLUTION:  5.8309518948E+00
  80. DIFF.  0.0000000000E+00
  81. $$$
  82.     Obviously, you can enter simple exepressions just to compute things
  83. for example:
  84.  
  85.     x=sqrt(34);print 'sqrt of 34 is:'x;run
  86.  
  87.    And the results will show as:
  88.  
  89. SQRT OF 34 IS: 5.8309518948E+00
  90.  
  91. $$$
  92.    SAVING /LOADING PROGRAMS:
  93.    -------------------------
  94.    Suppose we want to save the above code in a file name: test, then run
  95.    it. do:
  96.  
  97.     x=1;i=0;a=34;max=20;eps=1.0e-11
  98.     cont:y=(x+a/x)/2.;d=abs(x-y);x=y;i=i+1
  99.     if i>max goto finish;if d>eps goto cont
  100.     finish:print y;print a;print i;print d
  101.     x=sqrt(a);d=abs(x-y);print 'real solution:'x;print 'diff.'d
  102.     save test
  103.     run
  104.  
  105. $$$
  106.    EDITING PROGRAMS:
  107.    -----------------
  108.    1. Change code:
  109.  
  110.      Suppose we want to change max. number of iterations allowed (max)
  111.     and then re-run it. do:
  112.  
  113.     load test
  114.     edit
  115.     < Hit ENTER until the line: MAX=20  appears, retype it as:>
  116.     max=30
  117.     end       < to indicate end of editing, and then ..>
  118.     run
  119.  
  120. $$$
  121.    2. Delete code:
  122.  
  123.      Suppose we want to delete the command: print a    do:
  124.  
  125.     load test
  126.     edit
  127.     < Hit ENTER until the line: PRINT A appears, then do:>
  128.     d
  129.     end       < to indicate end of editing, and then ..>
  130.     run
  131.  
  132. $$$
  133.    3. Insert new code:
  134.  
  135.      Suppose we want to print the result (x) for each iteration, so we have
  136.     to insert a print command before the first IF test, right after the
  137.     command: i=i+1    , do:
  138.  
  139.  
  140.     load test
  141.     edit
  142.     < Hit ENTER until the line: I=I+1 appears, then do:>
  143.     i
  144.     print 'intermidiate result, x = 'x
  145.     end       < to indicate end of editing, and then ..>
  146.     run
  147.